// pages/group/type.js
let app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    library:0,
    start_status:0,
    project_status:0,
    groupList:[]
  },

  //跳转项目列表
  prepareList:function(e){
    var start_status = this.data.start_status;
    if(start_status>0){
      wx.navigateTo({
        url: '/pages/showList/showList?libraryTab='+this.data.library+'&start_status='+this.data.start_status+"&group="+e.currentTarget.dataset.val
      })
    }
    var project_status = this.data.project_status;
    if(project_status>0){
      wx.navigateTo({
        url: '/pages/showList/showList?libraryTab='+this.data.library+'&statusCode='+project_status+"&group="+e.currentTarget.dataset.val
      })
    }

    
  },

  //获取分组信息
  groupListApi:function(){
    var library = this.data.library;
    var start_status = this.data.start_status;
    var project_status = this.data.project_status;
    var params = {library:library,start_status:start_status,project_status:project_status};
    app.request('post', '/api/Project/groupList', params).then(res => {
      this.setData({groupList:res.data.list});
    }).catch(err => console.log(err));

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
      if(options.libraryTab!=undefined){
        this.setData({library:options.libraryTab});
      }
      if(options.start_status!=undefined){
        this.setData({start_status:options.start_status});
      }
      if(options.project_status!=undefined){
        this.setData({project_status:options.project_status});
      }
      this.groupListApi();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})